﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Modle.aspx.cs" Inherits="UI_Bas_Modle" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>模板维护</title> 
    <link href="../../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
  
    <script type ="text/javascript" >
    	$(function(){ 
    	
    	var defaultDate = Date.parse('1900/01/01');
        var _$modle = $("#modle");
        _$modle.datagrid({
            border: true,
            height: 345,
            title: '模板列表...',
            remoteSort: false,
            nowrap: true,
            striped: false,
            url: "../../TableHanders.aspx?act=q&tid=37&type=0",
            sortName: 'Id',
            sortOrder: 'asc',
            loadMsg: "正在加载,请稍后...",
            toolbar:[{
                    text:'Add',
                    iconCls:'icon-add',
                    handler:function(){
                        window.location.href = "ModleDetail.aspx?act=I";
                        return false;
                    }
                   }],
                    
            frozenColumns: [[
                      
                    { title: 'Operation',field: 'opt', width: 80, align: 'center',
                        formatter: function(val, row, index) {
                            var Id = row.Id;                            
                            return '<a href="#" onclick = "DeleteRow(this);" id = ' + Id + ' rowIndex = ' + index + ' style="color:red;">Delete</a>  ' 
                                +'<a href = "ModleDetail.aspx?act=U&id=' + Id + '">   Eidt</a>' ;                                    
                        }
                    },
	                { title: '编号',     field: 'Id', width:30,align:'center', sortable: true},
	                { title: '模板名称', field: 'ModleName', width:120, sortable: true},
	                { title: '模板内容', field: 'ModleContent', width:300, sortable: true} 
				  ]],           		   
            pagination: true,
            singleSelect: true,
            pageList: [10, 15, 20]
         });
        });   
             
       function DeleteRow(row) {
            var rowAttr = $(row);
            var id = rowAttr.attr('id');
            var rowIndex = rowAttr.attr('rowIndex');
            $.messager.confirm("请确认...", "确认删除?", function(value) {
                if (value) {
                    var url = "../../TableHanders.aspx?act=d&tid=37&type=1&id=" + id;
                    $.getJSON(
                        url,
                        function(data) {
                            var sdata = data[0];
                            var code = sdata.code;
                            if (code == 0) {
                                $("#modle").datagrid('deleteRow', rowIndex);
                            }
                            else {
                                alert(sdata.msg);
                            }
                        }
                        );
                }
            });
          }         
	</script>	
</head>
<body> 
   <div id="body">
       <form id="formQuery" runat="server">
             <div class="div_Title">
                   <span class="Body_Title">》》<%=this.Title %></span>
             </div>  
             <table  id="modle"></table>
       </form>
   </div>
</body>
</html>
